//
// Created on 2025/10/21.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#ifndef HOOK_OHOS_SYS_H
#define HOOK_OHOS_SYS_H
#include <stdint.h>
#include <sys/syscall.h>
#include <signal.h>
#include <unistd.h>
#include <limits.h> 
#include <elf.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef __SIGRTMIN
#define __SIGRTMIN 34
#endif

#ifndef ELF_ST_TYPE
#define ELF_ST_TYPE(info) ((info) & 0xF)
#endif

#ifndef STT_TLS
#define STT_TLS 6 // TLS 符号类型
#endif

#if defined(__GNUC__) || defined(__clang__)
#define __predict_false(x) __builtin_expect(!!(x), 0)
#define __predict_true(x)  __builtin_expect(!!(x), 1)
#else
#define __predict_false(x) (x)
#define __predict_true(x)  (x)
#endif

#include <deviceinfo.h>
// __ANDROID_API_M__
#define __OHOS_API_M__

typedef sigset_t sigset64_t;
#define uc_sigmask64 uc_sigmask
#define sigaction64 sigaction
typedef int64_t loff_t;

inline pid_t gettid(void)
{
    return (pid_t)syscall(SYS_gettid);
}

#ifdef __cplusplus
}
#endif
#endif // HOOK_OHOS_SYS_H
